{include file="public/head"}
<style>
    .header{
        width: 100%;
    }

    .header .title{
        width: 100%;
        padding: 2rem 0 1rem 2rem;
        font-size: 1rem;
    }

    .header .centent {
        padding: 1rem 0 1rem 2rem;
        font-size: 1.4rem;
    }

    .header .centent input {
        outline: none;
        border: none;
        font-size: 1.7rem;
    }

    .header .tips {
        padding: .5rem 0 1rem 2rem;
        font-size: .5rem;
        color: silver;
    }

    .list{
        width: 100%;
        height: 15.5rem;
        padding: 1rem;
    }

    .list ul:first-child{
        height: 1.5rem;
        line-height: 1.5rem;
        overflow: hidden;
    }

    .list ul:last-child{
        height: calc(100% - 1.5rem);
        overflow-y: scroll;
    }

    .list li{
        display: flex;
        justify-content: space-between;
        align-items: center;
        line-height: 2;
        font-size: 14px;
    }

    .list li span {
        width: 33.33%;
        display: inline-block;
    }

    .list li span:last-child{
        text-align: right;
    }

    .list li span:nth-child(2) {
        text-align: center;
    }

    .list .top {
        font-weight: 700;
    }

    .sub{
        width: 95%;
        background-color: #f23030;
        border: none;
        border-radius: .1rem;
        font-weight: 600;
        color:white;
        margin: 2rem 0 1rem 2.5%;
        padding: .5rem;
    }
    .zfpassword{
        margin: 1rem;
    }
    .zfpassword input{
        border: 1px solid #000;
        border-radius:3px;
        padding: .5rem 0;
        width: 100%;
    }
    .layui-layer-btn{
        display: flex;
        justify-content: space-between;
    }
</style>
<body>

<header class="aui-header-default aui-header-fixed aui-header-bg">
    <a href="javascript:history.back(-1)" class="aui-header-item">
        <i class="aui-icon aui-icon-back-white"></i>
    </a>
    <div class="aui-header-center aui-header-center-clear">
        <div class="aui-header-center-logo">
            <div class="aui-car-white-Typeface" style="color:black;font-weight: bold;">提现</div>
        </div>
    </div>
    <a href="#" class="aui-header-item-icon" style="min-width:0">
<!--        <i class="aui-icon aui-icon-member"></i>-->
    </a>
</header>

<section class="aui-settle-content">
    <div class="header">
        <div class="title">提现金额</div>
        <div class="centent">
            <span>￥</span>
            <input type="text" id="num" placeholder="0.00" onkeyup="this.value= this.value.match(/\d+(\.\d{0,2})?/) ? this.value.match(/\d+(\.\d{0,2})?/)[0] : ''" style="width: 8rem"/>
            <span style="font-size: .2rem">余额：￥{$UserInfo.balance_4}</span>
        </div>
        <div class="tips">提现手续费：{$Config.withdraw_fees*100}%</div>
    </div>
    <div class="aui-dri"></div>
    <div class="aui-settle-choice">
        <div class="aui-settle-ways">
            提现至
        </div>
        <a href="javascript:" class="aui-address-cell  aui-fl-arrow-clear">
            <div class="aui-address-cell-hd">
                <img src="__STATIC__/User/img/icon/reward.png" alt="">
            </div>
            <div class="aui-address-cell-bd">
                银行卡
                <p>{$BankInfo.bank_num}</p>
            </div>
            <div class="aui-address-cell-ft"><input type="radio" name="to_type" value="1" class="check check-pay goods-check goodsCheck" checked="checked"></div>
        </a>
        <a href="#" class="aui-address-cell  aui-fl-arrow-clear">
            <div class="aui-address-cell-hd">
                <img src="__STATIC__/User/img/icon/apy-4.png" alt="">
            </div>
            <div class="aui-address-cell-bd">
                支付宝
                <p></p>
            </div>
            <div class="aui-address-cell-ft"><input type="radio" name="to_type" value="2" class="check check-pay goods-check goodsCheck"></div>
        </a>
        <a href="#" class="aui-address-cell  aui-fl-arrow-clear">
            <div class="aui-address-cell-hd">
                <img src="__STATIC__/User/img/icon/apy-5.png" alt="">
            </div>
            <div class="aui-address-cell-bd">
                微信
                <p></p>
            </div>
            <div class="aui-address-cell-ft"><input type="radio" name="to_type" value="3" class="check check-pay goods-check goodsCheck"></div>
        </a>
        <!--        <a href="#" class="aui-address-cell  aui-fl-arrow-clear">-->
        <!--            <div class="aui-address-cell-hd">-->
        <!--                <img src="__STATIC__/User/img/icon/point.png" alt="">-->
        <!--            </div>-->
        <!--            <div class="aui-address-cell-bd">-->
        <!--                农业银行-->
        <!--                <p>储蓄卡（5678）</p>-->
        <!--            </div>-->
        <!--            <div class="aui-address-cell-ft"><input type="radio" name="pay_type" value="2" class="check check-pay goods-check goodsCheck" ></div>-->
        <!--        </a>-->
        <!--        <a href="#" class="aui-address-cell  aui-fl-arrow-clear">-->
        <!--            <div class="aui-address-cell-hd">-->
        <!--                <img src="__STATIC__/User/img/icon/shares.png" alt="">-->
        <!--            </div>-->
        <!--            <div class="aui-address-cell-bd">-->
        <!--                招商银行-->
        <!--                <p>储蓄卡（8890）</p>-->
        <!--            </div>-->
        <!--            <div class="aui-address-cell-ft"><input type="radio" name="pay_type" value="3" class="check check-pay goods-check goodsCheck"></div>-->
        <!--        </a>-->
    </div>
    <input type="submit" class="sub" value="确认提现">
    <div class="list">
        <ul class="top">
            <li>
                <span>金额</span>
                <span>时间</span>
                <span>状态</span>
            </li>
        </ul>
        <ul>
            {volist name="WithdrawList" id="v"}
            <li>
                <span>{$v.num}</span>
                <span>{$v.add_time|date="m-d H:i",###}</span>
                {if condition="$v.status eq 0"}<span style="color:silver">待处理</span>
                {elseif condition="$v.status eq 1"}<span style="color:green">已通过</span>
                {elseif condition="$v.status eq 2"}<span style="color:red">已驳回</span>
                {/if}
            </li>
            {/volist}
        </ul>
    </div>
</section>
<script type="text/javascript" src="__STATIC__/User/js/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/Admin/layer/layer.js"></script>
<script>
    $(function () {
        var BankInfo = "{$BankInfo.bank_num}";
        if(BankInfo=="" || BankInfo==null){
            alert('请先完善提现信息！')
            window.location.href="{:url('User/UserBank')}";
            return false;
        }

        $(".sub").on('click',function () {
            var num = $("#num").val();
            var to_type = $("input[name='to_type']:checked").val();
            if(num <= 0 || num ==""){
                alert('请输入提现金额');
                return false;
            }

            layer.open({
                type: 1,
                title: '请输入支付密码',
                area: ["80%", "9.5rem"],
                closeBtn: 1,
                // skin: 'layui-layer-lan'
                content: '<div class="zfpassword"><input type="password" id="paypassword"></div>',
                btn:['确定','取消'],
                yes:function() {
                    var password = $('#paypassword').val();
                    $.ajax({
                        type:"POST",
                        url:"{:url('User/UserWithdraw')}",
                        data:{
                            num:num,
                            to_type:to_type,
                            password:password
                        },
                        dataType:"json",
                        success:function(data){
                            if(data.status == 1){
                                alert(data.message);
                                window.location.reload();
                            }else if(data.status == 2){
                                alert(data.message);
                                window.location.href="{:url('User/UserBank')}";
                            }else{
                                alert(data.message);
                            }
                        }
                    })
                }

            })
            /*var password = prompt("请输入支付密码");
            if (password!=null && password!=""){
                $.ajax({
                    type:"POST",
                    url:"{:url('User/UserWithdraw')}",
                    data:{
                        num:num,
                        to_type:to_type,
                        password:password
                    },
                    dataType:"json",
                    success:function(data){
                        if(data.status == 1){
                            alert(data.message);
                            window.location.reload();
                        }else if(data.status == 2){
                            alert(data.message);
                            window.location.href="{:url('User/UserBank')}";
                        }else{
                            alert(data.message);
                        }
                    }
                })
            }else{
                alert("请输入支付密码")
            }*/
        })
    })
</script>
</body>
</html>